#include "mystdio.h"
#include <string.h>
#include <cstdio>
int main()
{
    mFile* fp = myfopen("log.txt","w");
    if(fp == NULL)
    {
        return 1;
    }
    int cnt = 10;
    while(cnt)
    {
        printf("write %d\n", cnt);
        char buffer[64];
        snprintf(buffer, sizeof(buffer),"hello message, number is : %d", cnt);
        cnt--;
        myfwrite(buffer,1, strlen(buffer), fp);
        myfflush(fp);
        sleep(1);
    }
    myfclose(fp);

    return 0;
}

//int main()
//{
//    FILE* fp = fopen("log.txt","w");
//    if(fp == NULL)
//    {
//        return 1;
//    }
//    int cnt = 10;
//    while(cnt)
//    {
//        printf("write %d", cnt);
//        char buffer[64];
//        snprintf(buffer, sizeof(buffer),"hello message, number is : %d", cnt);
//        cnt--;
//        fwrite(buffer,1, strlen(buffer), fp);
//        fflush(fp);
//        sleep(1);
//    }
//    fclose(fp);
//
//    return 0;
//}
